

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Getting Started &mdash; Fityk 1.1.1 manual</title>
    <link rel="stylesheet" href="_static/fityk.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.1.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/fityk.ico"/>
    <link rel="top" title="Fityk 1.1.1 manual" href="index.html" />
    <link rel="next" title="Mini-Language" href="lang.html" />
    <link rel="prev" title="Introduction" href="intro.html" />
 


  </head>
  <body>
<div style="background-color: white; text-align: center; padding: 10px 10px 10px 10px">
 <a href="http://fityk.nieto.pl/"><img src="_static/fityk-banner.png" alt="" /></a>
</div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<h3><a href="fityk-manual.html">Table Of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Getting Started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#graphical-interface">Graphical Interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="#minimal-example">Minimal Example</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="lang.html">Mini-Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="data.html">Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="model.html">Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="fit.html">Curve Fitting</a></li>
<li class="toctree-l1"><a class="reference internal" href="ref.html">All the Rest</a></li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/getstarted.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="getting-started">
<span id="getstarted"></span><h1>Getting Started</h1>
<div class="section" id="graphical-interface">
<h2>Graphical Interface</h2>
<p>The GUI window of fityk consists of (from the top): menu bar, toolbar,
main plot, helper (residual) plot, output window, input field, status bar
and of sidebar at the right-hand side.</p>
<p>The input field with the output window provide a console-like interface
to the program. The output windows shows also commands corresponding to
operations performed using the GUI (menu, dialogs, etc.).</p>
<p>The main plot can display data points, model that is to be fitted to the
data and component functions of the model. Use the pop-up menu (click
right button on the plot) to configure it. Some properties of the plot
(e.g. colors of data points) can be changed using the sidebar.</p>
<p>One of the most useful things which can be displayed by the helper
plot is the difference between the data and the model (it is also controlled
by a pop-up menu). Hopefully, a quick look at this menu and a minute or
two&#8217;s worth of experiments will show the potential of this plot.</p>
<p>Configuration of the GUI (visible windows, colors, etc.) can be saved
using <em class="menuselection">GUI ‣ Save current config</em>.</p>
<a class="reference internal image-reference" href="_images/fityk-with-tooltip1.png"><div align="center" class="align-center"><img alt="_images/fityk-with-tooltip1.png" class="align-center" src="_images/fityk-with-tooltip1.png" style="width: 547.5px; height: 423.0px;" /></div>
</a>
<p>On the <strong>main plot</strong>, the meaning of the left and right mouse button depends
on current <em class="dfn">mode</em>.
There are hints on the status bar. In normal mode, the left button is
used for zooming and the right invokes the pop-up menu.</p>
<p>On the <strong>helper plot</strong>, selecting a horizontal range with the left button
will show this range, automatically adjusting vertical range.
The middle button shows the whole dataset (like <img alt="Zoom All" class="icon" src="_images/zoom_all1.png" /> in the toolbar).
The right button displays a menu.</p>
</div>
<div class="section" id="minimal-example">
<h2>Minimal Example</h2>
<p>Let us analyze a diffraction pattern of NaCl. Our goal is to determine
the position of the center of the highest peak. It is needed for
calculating the pressure under which the sample was measured, but this
later detail in the processing is irrelevent for the time being.</p>
<p>The data file used in this example is distributed with the program and
can be found in the <tt class="file docutils literal"><span class="pre">samples</span></tt> directory.</p>
<p>First load data from file <tt class="file docutils literal"><span class="pre">nacl01.dat</span></tt>.
You can do this by typing:</p>
<div class="highlight-fityk"><div class="highlight"><pre>@0 &lt; nacl01.dat
</pre></div>
</div>
<p>The <abbr title="Command Line Interface">CLI</abbr> version of the program is all
about typing commands. From time to time it is also handy to type
a command in the <abbr title="Graphical User Interface">GUI</abbr>,
but usually the GUI provides more intuitive, mouse-driven way to perform
the same operation &#8211; it is mentioned in the the grey boxes below.</p>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">select <em class="menuselection">Data ‣ Load File</em>
from the menu (or <img alt="Load Data" class="icon" src="_images/load_data_icon.png" /> from the toolbar) and choose the file.</p>
</div>
<p>If you use the GUI, you can zoom-in to the biggest peak using left mouse
button on the residual plot (the plot below the main plot).
To zoom out, press the <em class="guilabel">View whole</em> toolbar button.</p>
<p>Now all data points are active. Because only the biggest peak is of
interest for the sake of this example, the remaining points can be
deactivated:</p>
<div class="highlight-fityk"><div class="highlight"><pre>A = (x &gt; 23.0 and x &lt; 26.0)
</pre></div>
</div>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">change to the <em class="dfn">range</em> mode (toolbar: <img alt="Data-Range Mode" class="icon" src="_images/mode_range_icon.png" />)
and deactivate not needed points with the right mouse button.</p>
</div>
<p>As our example data has no background to worry about, our next step is
to define a peak with reasonable initial values and fit it to the data.
We will use Gaussian.
To see its formula, type: <tt class="docutils literal"><span class="pre">info</span> <span class="pre">Gaussian</span></tt> (or <tt class="docutils literal"><span class="pre">i</span> <span class="pre">Gaussian</span></tt>) or look for it
in the section <a class="reference internal" href="model.html#flist"><em>Built-In Functions</em></a>.</p>
<p>To add a peak, either set the initial parameters manually:</p>
<div class="highlight-fityk"><div class="highlight"><pre>F += Gaussian(~60000, ~24.6, ~0.2)
</pre></div>
</div>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">it is also possible to set the initial parameters with the mouse:
change the GUI mode to <img alt="Add-Peak Mode" class="icon" src="_images/mode_add_icon.png" />,
click on the plot and drag the mouse to select
the position, height and width of a new peak.</p>
</div>
<p>or let the program guess it:</p>
<div class="highlight-fityk"><div class="highlight"><pre>guess Gaussian
</pre></div>
</div>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">select <em class="guilabel">Gaussian</em> from the list of functions on the toolbar
and press <img alt="Auto Add" class="icon" src="_images/add_peak_icon.png" />.</p>
</div>
<p>If the functions are not named explicitely (like in this example),
they get automatic names <tt class="docutils literal"><span class="pre">%_1</span></tt>, <tt class="docutils literal"><span class="pre">%_2</span></tt>, etc.</p>
<p>Now let us fit the function. Type: <tt class="docutils literal"><span class="pre">fit</span></tt>.</p>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">select <em class="menuselection">Fit ‣ Run</em> from the menu or press <img alt="Fit" class="icon" src="_images/fit_icon1.png" />.</p>
</div>
<div class="admonition important">
<p class="first admonition-title">Important</p>
<p class="last">Fitting minimizes the <strong>weighted</strong> sum of squared residuals
(see <a class="reference internal" href="fit.html#nonlinear"><em>Nonlinear Optimization</em></a>).
The default <a class="reference internal" href="data.html#weights"><em>weights of points</em></a> are not equal.</p>
</div>
<p>To see the peak parameters, type: <tt class="docutils literal"><span class="pre">info</span> <span class="pre">prop</span> <span class="pre">%_1</span></tt>.</p>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">move the cursor to the top of the peak
and try out the context menu (the right mouse button),
or check the parameters on the sidebar.</p>
</div>
<p>That&#8217;s it!</p>
<p>You can save all the issued commands to a file:</p>
<div class="highlight-fityk"><div class="highlight"><pre>info history &gt; myscript.fit
</pre></div>
</div>
<p>and later use it as a macro:</p>
<div class="highlight-fityk"><div class="highlight"><pre>exec myscript.fit
</pre></div>
</div>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">use <em class="menuselection">Session ‣ Save History</em>
and <em class="menuselection">Session ‣ Execute script</em>, correspondingly.</p>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="lang.html" title="Mini-Language"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="intro.html" title="Introduction"
             accesskey="P">previous</a> &nbsp; </li>
  <li><a href="http://fityk.nieto.pl/">Home</a>&nbsp;&nbsp;&nbsp;</li>
  <li><a href="https://github.com/wojdyr/fityk/wiki">Wiki</a>&nbsp;&nbsp;&nbsp;</li>
  
        <li><a href="fityk-manual.html">Manual</a> </li>
 
      </ul>
    </div>
    <div class="footer">
      Last updated on 2011-09-28.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>